import axios from "@/utils/axios";
//加密算法
// import { shaCrypto } from '../utils/crypto';
import { pubKeyBase64 } from "@/constants";
import JSEncrypt from "jsencrypt";
export const login = ({ username, password }) => {
  const encryptor = new JSEncrypt(); // 创建加密对象实例
  const pubKey = window.atob(pubKeyBase64);
  encryptor.setPublicKey(pubKey);
  const rsaPassWord = encryptor.encrypt(password);
  return axios.post("/user/login", {
    userName: username,
    password: rsaPassWord,
  });
};
// export const userInfo = () => {
//     return axios.get("/current/user");
// };
export const userInfo = () => {
  return axios.get("/um/user/info");
};

export const getOauth = (parmas) => {
  return axios.get("/user/oauth", parmas);
};
export const outLogin = () => {
  return axios.post("/logout");
};
